local Class = require("Core.Class")
local LuaBehaviour = require("Core.LuaBehaviour")
local CSType = require("Core.CSType")

--- @Class BaseMapItem
local BaseMapItem = Class("BaseMapItem", LuaBehaviour)

function BaseMapItem:__init()
    self.hardness = 0
    self.isThroughing = false
end

function BaseMapItem:OnTriggerEnter2D(other)
    if other:CompareTag('EmenyBullet') then
        if self.hardness < 2 then
            CSE.Object.Destroy(self.gameObject)
        end
    end

    if other:CompareTag('PlayerBullet') then
        if self.hardness >= 2 then
            local playerBullet = other.gameObject:GetComponent('LuaBehaviour').LuaClass
            if playerBullet.grade < 2 then
                return
            end
        end
        CSE.Object.Destroy(self.gameObject)
    end
end

return BaseMapItem